export default function stringToNodes(keyword, value) {
  const nodes = []
  if (keyword.startsWith(value)) {
    const key1 = keyword.slice(0, value.length)
    const key2 = keyword.slice(value.length)

    const node1 = {
      name: "span",
      attrs: {
        style: "color:#26ce8a"
      },
      children: [{
        type: "text",
        text: key1
      }]
    }
    const node2 = {
      name: "span",
      attrs: {
        style: "color:black"
      },
      children: [{
        type: "text",
        text: key2
      }]
    }
    nodes.push(node1)
    nodes.push(node2)

    // console.log(key1, key2);
  } else {
    const node = {
      name: "span",
      attrs: {
        style: "color:black"
      },
      children: [{
        type: "text",
        text: keyword
      }]
    }
    nodes.push(node)
  }
  return nodes
}